package com.qiantu.phone.widget.setting;

import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.hjq.widget.layout.SettingBar;
import com.qiantu.api.entity.DeviceBean;
import com.qiantu.phone.R;
import com.qiantu.phone.app.AppActivity;
import com.qiantu.phone.ui.activity.DeviceAngleActivity;
import com.qiantu.phone.ui.activity.DeviceTravelActivity;

public class DeviceSettingAngle extends SettingBar implements View.OnClickListener {
    private DeviceBean mDevice;
    private AppActivity mContext;
    private String queryCode;
    private int totalTime = 20 * 1000;
    private long startTime;

    public DeviceSettingAngle(AppActivity context, DeviceBean deviceBean, String title) {
        this(context, null, deviceBean, title);
    }

    public DeviceSettingAngle(AppActivity context, AttributeSet attrs, DeviceBean deviceBean, String title) {
        this(context, attrs, 0, deviceBean, title);
    }

    public DeviceSettingAngle(AppActivity context, AttributeSet attrs, int defStyleAttr, DeviceBean deviceBean, String title) {
        this(context, attrs, defStyleAttr, R.style.setting_item_style, deviceBean, title);
    }

    public DeviceSettingAngle(@NonNull AppActivity context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes, DeviceBean deviceBean, String title) {
        super(context, attrs, defStyleAttr, defStyleRes);
        mDevice = deviceBean;
        mContext = context;
        setLeftText(title);
        setOnClickListener(this::onClick);
    }
    @Override
    public void onClick(View v) {
        DeviceAngleActivity.start(mContext,mDevice.getDeviceSerialNo());
    }
}

